/* GUI CONVERTED from reorp24b.p (converter v1.75) Tue Jun  5 16:01:02 2001 */
/* reorp24b.p - DOWNTIME REPORT FROM OPERATIONS STD. REPETITIVE               */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.4.1.3 $                                                           */
/*V8:ConvertMode=FullGUIReport                                                */
/* REVISION: 7.3            CREATED: 04/03/96   BY: jym *G1S7*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */
/* Old ECO marker removed, but no ECO header exists *K14S*                    */
/* $Revision: 1.4.1.3 $    BY: Hualin Zhong  DATE: 05/30/01 ECO: *N0YY*          */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE reorp24b_p_2 "Operation"
/* MaxLen: Comment: */

&SCOPED-DEFINE reorp24b_p_4 "Downtime"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

{wbrp02.i}

define input parameter part like pt_part.
define input parameter part1 like pt_part.
define input parameter opdate like op_date.
define input parameter opdate1 like op_date.
define input parameter emp like op_emp.
define input parameter emp1 like op_emp.
define input parameter rsn like op_rsn.
define input parameter rsn1 like op_rsn.
define input parameter shift like op_shift.

define variable name like ad_name.
define variable down_desc like rsn_desc.
define variable down_rsn       like op_rsn.

if shift > "" then do:
   FORM /*GUI*/  header
      getTermLabel("SHIFT",10) + ": " + shift at 61 format "x(14)"
   with STREAM-IO /*GUI*/  frame shift width 132 page-top no-attr-space.
   view frame shift.
end.

/* OLD REPETITIVE FUNCTIONALITY */
for each op_hist
where op_part >= part and op_part <= part1
      and (op_date >= opdate and op_date <= opdate1)
      and (op_emp >= emp and op_emp <= emp1)
      and (op_rsn >= rsn and op_rsn <= rsn1)
      and (op_type = "DOWN" or op_type = "DOWNTIME")
      and (op_shift = shift or shift = "")
      and (op_rsn > "" or (op_rsn = "" and op__chr01 = ""))
      use-index op_date
      no-lock break by op_rsn by op_part by op_date by op_emp
   with frame b width 132 no-attr-space:

   /* SET EXTERNAL LABELS */
   setFrameLabels(frame b:handle).

   if first-of(op_rsn) then do with frame b:
      down_desc = "".
      find rsn_ref where rsn_type = "downtime"
         and rsn_code = op_rsn no-lock no-error.
      if available rsn_ref then down_desc = rsn_desc.
      display op_rsn down_desc WITH STREAM-IO /*GUI*/ .
   end.

   if first-of(op_part) then display op_part WITH STREAM-IO /*GUI*/ .

   if first-of(op_date) then display op_date WITH STREAM-IO /*GUI*/ .

   accumulate op_act_run (total by op_rsn).

   name = "".
   find emp_mstr where emp_addr = op_emp no-lock no-error.
   if available emp_mstr then name = emp_fname + " " + emp_lname.

   display
      op_emp
      name format "x(24)" WITH STREAM-IO /*GUI*/ .

   find ro_det where ro_routing = op_part and ro_op = op_wo_op
      no-lock no-error.
   if available ro_det then
      display
         ro_desc column-label {&reorp24b_p_2} WITH STREAM-IO /*GUI*/ .

   display
      op_act_run column-label {&reorp24b_p_4} format "->>>9.999" WITH STREAM-IO /*GUI*/ .

   if last-of(op_rsn) then do with frame b:
      down 1.
      display
         fill("-",10) format "x(9)" @ op_act_run
            column-label {&reorp24b_p_4} WITH STREAM-IO /*GUI*/ .
      down 1.
      display
         getTermLabelRt("TOTAL",20) @ ro_desc
         (accum total by op_rsn op_act_run) @ op_act_run
            column-label {&reorp24b_p_4} WITH STREAM-IO /*GUI*/ .
      down 1.
   end.

   if last(op_rsn) then do with frame b:
      down 1.
      display
         getTermLabelRt("REPORT_TOTAL",20) @ ro_desc
         (accum total op_act_run) @ op_act_run
            column-label {&reorp24b_p_4} WITH STREAM-IO /*GUI*/ .
   end.

   
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/

end. /* for each */
{wbrp04.i}
